-
-
Couldn't load subscription status.
- Fork 33.2k
Optimize json.dump() to reduce multiple I/O operations and improve performance #129770
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
|
Using Also see the dev guide https://devguide.python.org/ on how to create PRs. |
This PR optimizes
json.dump()by reducing multiple I/O operations and replacing them with a single efficient write.🔹 Problem:
json.dump(x, f)was significantly slower thanf.write(json.dumps(x))due to multiple write calls.🔹 Solution:
🔹 Performance Benchmark:
json.dump(): SLOW due to multiple writes.json.dump(): 🚀 2-3x Faster by reducing I/O calls.✅ All tests pass, and this change preserves all functionality.